<!-- getList 页 -->
<template>
  <div class="app-container">
    <el-table :data="list"
              border
              fit
              highlight-current-row
              style="width: 100%">
      <el-table-column align="center"
                       label="ID"
                       width="80px">
        <template slot-scope="{row}">
          <span>{{ row._id }}</span>
        </template>
      </el-table-column>

      <el-table-column align="center"
                       label="提交时间"
                       width="180px">
        <template slot-scope="scope">
          <span>1</span>
        </template>
      </el-table-column>

      <el-table-column align="center"
                       label="商品名称"
                       min-width="468px">
        <template slot-scope="{row}">
          <span>{{ row.name }}</span>
        </template>
      </el-table-column>

      <el-table-column align="center"
                       label="提交人"
                       width="200px">
        <template slot-scope="{row}">
          <span>{{ row.business.company_name }}</span>
        </template>
      </el-table-column>

      <el-table-column class-name="status-col"
                       align="center"
                       label="审核状态"
                       width="110px">
        <template slot-scope="{row}">
          <el-tag v-if="row.is_check==0"
                  type="info">
            未上架
          </el-tag>
          <el-tag v-if="row.is_check==2"
                  type="danger">
            审核不通过
          </el-tag>
          <el-tag v-if="row.is_check==1"
                  type="success">
            已审核
          </el-tag>
        </template>
      </el-table-column>

      <el-table-column class-name="status-col"
                       align="center"
                       label="上架状态"
                       width="110px">
        <template slot-scope="{row}">
          <el-tag v-if="row.is_show==0"
                  type="info">
            未上架
          </el-tag>
          <el-tag v-if="row.is_show==1"
                  type="success">
            已上架
          </el-tag>
        </template>
      </el-table-column>

      <el-table-column class-name="status-col"
                       align="center"
                       label="删除状态"
                       width="110px">
        <template slot-scope="{row}">
          <el-tag v-if="row.is_del==0">
            未删除
          </el-tag>
          <el-tag v-if="row.is_del==1"
                  type="danger">
            已删除
          </el-tag>
        </template>
      </el-table-column>

      <el-table-column align="center"
                       label="操作"
                       width="180px">
        <template slot-scope="scope">
          <router-link :to="'/example/edit/'+scope.row.id">
            <el-button type="primary"
                       size="small"
                       icon="el-icon-edit">
              查看
            </el-button>
          </router-link>
          <router-link :to="'/example/edit/'+scope.row.id">
            <el-button type="primary"
                       size="small"
                       icon="el-icon-edit">
              修改
            </el-button>
          </router-link>
        </template>
      </el-table-column>

    </el-table>

  </div>

</template>

<script>

export default {
  name: 'GetList',
  components: {},
  data () {
    return {
      list: null
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created () {
    this.getList()
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted () {

  },
  // 函数
  methods: {
    getList () {
      this.$api.product.getProductList().then(res => {
        console.log('this.$api.product.getProductList => res', res)
        this.list = res.data
        console.log('this.$api.product.getProductList => this.list', this.list)
      })
    }
  }
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入css类 */
.getList {
}
</style>
